}
let name = unit.pkg.name().to_string();
- let desc = rustdoc.to_string();
+ let build_state = cx.build_state.clone();
+ let key = (unit.pkg.package_id().clone(), unit.kind);
let exec_engine = cx.exec_engine.clone();
Ok(Work::new(move |desc_tx| {
- desc_tx.send(desc).unwrap();
+ if let Some(output) = build_state.outputs.lock().unwrap().get(&key) {
+ for cfg in output.cfgs.iter() {
+ rustdoc.arg("--cfg").arg(cfg);
+ }
+ }
+ desc_tx.send(rustdoc.to_string()).unwrap();
exec_engine.exec(rustdoc).chain_error(|| {
human(format!("Could not document `{}`.", name))
})